-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add khidusage_keyboardclear as possible option for text field clear on iOS #810
Conversation
if (![FBKeyboard typeText:textToType error:error]) { | ||
NSString *backspacesToType = [backspaceDeleteSequence fb_repeatTimes:preClearTextLength]; | ||
#if TARGET_OS_IOS | ||
if (retry == MAX_CLEAR_RETRIES - 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so,
1st attempt -> typeText
2nd -> fb_performIOHIDEventWithPage
3rd -> tapWithNumberOfTaps:3
correct? Or I wondered if we could try the fb_performIOHIDEventWithPage first, then typeText, but the last one will be tapWithNumberOfTaps:3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's about #811 ?
if (retry >= MAX_CLEAR_RETRIES - 1) { | ||
return [[[FBErrorBuilder builder] | ||
withDescriptionFormat:@"'%@' cannot be cleared of its text", snapshot.fb_description] | ||
buildError:error]; | ||
} else if (![FBKeyboard typeText:backspacesToType error:error]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change here to:
if (retry >= MAX_CLEAR_RETRIES - 1) {
return [FBKeyboard typeText:backspaceDeleteSequence error:error];
} else if (![FBKeyboard typeText:backspacesToType error:error]) {
return NO;
}
?
In the current implementation, calling clear text for an empty search field generates the below error. (This was Apple's general search field in the tvOS's content search)
> e.clear
Selenium::WebDriver::Error::InvalidElementStateError: Error Domain=com.facebook.WebDriverAgent Code=1 "'XCUIElementTypeSearchField' cannot be cleared of its text" UserInfo={NSLocalizedDescription='XCUIElementTypeSearchField' cannot be cleared of its text}
This was because self.fb_takeSnapshot.value
kept returning its place holder while the field was empty (self.fb_takeSnapshot.label was nil). So we potentially can add label
comparison as well in addition to currentValue = self.fb_takeSnapshot.value
... but not sure it is a better idea.
So, just keeping existing behavior with return [FBKeyboard typeText:backspaceDeleteSequence error:error];
would be safe to keep current clear text's behavior for already cleared field.
closed in favour of #810 |
appium/appium#19389